package cn.edu.hunan.pm.mapper;

import cn.edu.hunan.pm.Entity.Patent;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PatentMapper {
    @Select("SELECT * FROM Patents")
    List<Patent> findAll();

    @Insert("INSERT INTO Patents(patentName, owner, transactionPrice) VALUES(#{patentName}, #{owner}, #{transactionPrice})")
    void insert(Patent patent);

    @Update("UPDATE Patents SET patentName=#{patentName}, owner=#{owner}, transactionPrice=#{transactionPrice} WHERE patentID=#{patentID}")
    void update(Patent patent);

    @Delete("DELETE FROM Patents WHERE patentID=#{patentID}")
    void delete(int patentID);
}
